<html>
<head>
<title>购物车 - 订单号:{dede:var.carts.orders_id/}</title>
<meta charset="{dede:global.cfg_soft_lang/}" />
<meta name="keywords" content="{dede:field name='keywords' function='html2text(@me)'/}" />
<meta name="description" content="{dede:field name='description' function='html2text(@me)'/}" />


{dede:include filename="plus_header.htm"/}
<!-- /header -->
<main>
<!-- 面包屑 -->
{dede:include filename="plus_breadcrumb.htm"/}
<!-- /面包屑 -->

<section class="uk-section uk-section-default uk-section-smalle">
    <div class="uk-container">
    <div class="uk-article">

<h2>购物车</h2>

<h2>我的购物车 - 订单号: <em id="carId">{dede:var.carts.orders_id/}</em></h2>

<form id="form1" name="form1" method="post" action="posttocar.php">
<input id="dopost" name="do" type="hidden" value="del" />
<!--startprint1-->

<div class="uk-card uk-card-small uk-card-default" style="margin-top: 40px;margin-bottom: 40px;">
    <div class="uk-card-header">
    <div class="uk-grid uk-grid-small uk-text-small">
    <div class="uk-width-expand uk-first-column">
    <span class="cat-txt">商品列表</span>
    </div>
    </div>
    </div>
    <div class="uk-card-body uk-padding-remove">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="uk-table">
<thead>
<tr>
<td></td>
<td>编号</td>
<td>名称</td>
<td>数量</td>
<td>单价(元)</td>
<td>操作</td>
</tr>
</thead>
<tbody>
<!--以下列出购物车内购商品列表(数组),开始遍历数组-->

{dede:array.Items}
<tr>
<td><input type="checkbox" name="ids[]" value="{dede:value.id/}" class="uk-checkbox dede-checkbox"/></td>
<td>{dede:value.id/}</td>
<td><a href="view.php?aid={dede:value.id/}"
target="_bank">{dede:value.title/}</a></td>
<td>
<input name="buynum{dede:value.id/}" type="text" id="buynum{dede:value.id/}" value="{dede:value.buynum/}"  maxlength="5" class="uk-input uk-form-small uk-width-small" />
<small>{dede:value.units/}</small>
</td>
<td>{dede:value.price/}</td>
<td><a href="posttocar.php?do=del&ids={dede:value.id/}">删除</a></td>
</tr>
{/dede:array}
<!--构造购物车内商品列表结束-->
</tbody>
<tfoot>
<tr>
<td colspan="6" align="right">
<div style="float:left;">
共 <font color=red>{dede:var.carts.cart_count/}</font> 件商品,合计: <font color=red>
{dede:var.carts.price_count/}</font>元 </div>
<div style="float:right; height:33px;">
<!--<input type="button" value="打印购物车" class="btn-2" onclick="printPage(1)"/>-->
<input type="button" value="更新订单号" class="uk-button uk-button-small" onclick="makeCarId()" />
<input type="button" value="删除已选定" class="uk-button uk-button-small" onclick="DelPost()" />
<input type="button" value="清空" onclick="if(confirm('确定清空购物车中的商品吗?')){ location='posttocar.php?do=clear' }" class="uk-button uk-button-small" />
<input onclick="ChangePost()" type="button" value="更新数量" class="uk-button uk-button-small" />
<input type="button" value="下一步" onclick="location='carbuyaction.php'" class="uk-button uk-button-small uk-button-primary" />
</div>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
<!--endprint1-->
</form>
</div>
</div>
</section>
<!--购物车列表操作javascript请不要随意改动-->
<script language="JavaScript" type="text/javascript">
//遍历checkbox使之全选中,或反选
function CheckAll() {
for (var i = 0; i < document.form1.elements.length; i++) {
var e = document.form1.elements[i];
e.checked == true ? e.checked = false : e.checked = true;
}
}
//改变表单dopost值为:update,后submit提交表单
function ChangePost() {
CheckAll();
document.getElementById("dopost").value = 'update';
document.form1.submit();
}
//改变表单dopost值为:del,后submit提交表单
function DelPost() {
document.getElementById("dopost").value = 'del';
document.form1.submit();
}
//AJAX产生一个新的订单编号
function makeCarId() {
$.ajax({ type: "POST", url: "car.php", data: "dopost=makeid", dataType: 'text', success: function (result) { $("#carId").html(result); } });
}
//Print Page
function printPage(oper) {
if (oper < 10) {
bdhtml = window.document.body.innerHTML;//获取当前页的html代码
sprnstr = "<!--startprint" + oper + "-->";//设置打印开始区域
eprnstr = "<!--endprint" + oper + "-->";//设置打印结束区域
prnhtml = bdhtml.substring(bdhtml.indexOf(sprnstr) + 18); //从开始代码向后取html
prnhtml = prnhtml.substring(0, prnhtml.indexOf(eprnstr));//从结束代码向前取html
window.document.body.innerHTML = prnhtml;
window.print();
window.document.body.innerHTML = bdhtml;
} else {
window.print();
}
}
</script>
<!--购物车列表操作javascript结束-->
<!-- //底部模板 -->
{dede:include filename="plus_footer.htm"/}
<script language="JavaScript" type="text/javascript">
if (!navigator.cookieEnabled) {
$('#errorChickCookie').html('您浏览器的 cookie 功能被禁用,请启用此功能!');
$('.buycar').hide();
}
</script>
</body>
</html>
